using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class ViewReports : System.Web.UI.Page
{
    string UrlTemp="";
    protected void Page_Load(object sender, EventArgs e)
    {
        UrlTemp = Request.Url.ToString().Replace("ViewReports.aspx", "");
    }
    protected void btnViewOverallFinance_Click(object sender, EventArgs e)
    {
        string year = ddlYear01.SelectedValue;
        string branch = ddlBranch01.SelectedValue;
        string url = "OverallFinanceReport.aspx?Year=" + year + "&Branch=" + branch;
        OpenNewwindow(url);
    }

    protected void btnViewFinanceByService_Click(object sender, EventArgs e)
    {
        string year=ddlYear02.SelectedValue;
        string branch = ddlBranch02.SelectedValue;
        string url ="FinanceByTypeOfService.aspx?Year=" + year + "&Branch=" + branch;
            OpenNewwindow(url);
        
    }
    protected void btnViewSummaryByDistance_Click(object sender, EventArgs e)
    {
        string year = ddlYear04.SelectedValue;
        string month = ddlMonth02.SelectedValue;
        string url ="DeliverySummaryByDistanceReport.aspx?Year=" + year + "&Month=" + month;

        OpenNewwindow(url);
    }
    protected void btnViewSummaryByBranches_Click(object sender, EventArgs e)
    {
        string year = ddlYear03.SelectedValue;
        string month = ddlMonth01.SelectedValue;
        string url ="DeliverySummaryByBranchReport.aspx?Year=" + year + "&Month=" + month;
        OpenNewwindow(url);
    }
    private void OpenNewwindow(string newWindowUrl)
    {
        if (!ClientScript.IsClientScriptBlockRegistered("window.open"))
        {
            string javaScript =
          "<script type='text/javascript'>\n" +
          "<!--\n" +
          "window.open('" + newWindowUrl + "');\n" +
          "// -->\n" +
          "</script>\n";
            this.RegisterStartupScript("", javaScript); 
        }
        else
        {
            Response.Redirect(newWindowUrl);
        }
     
    }
}
